
public class Punkt {
	
	private static int variante = 3;
	private static int number = 0;
	private int x;
	private int y;
	private int id;

	public Punkt(int x, int y) {
		number++;
		this.x = x;
		this.y = y;
		id = number;
	}
	
	public int getX(){
		return x;
	}
	
	public int getY(){
		return y;
	}
	
	public int hashCode(){
		int out = 0;
		switch (variante){
		//variante 1
			case 1:
				out = id+x+y;
				break;
		//variante 2
			case 2:
				out = id+x+y;
				break;
		//variante 3
			case 3:
				if(x == y){
					out = 1;
				}
				break;
		//default
			default:
				break;
		}
		return out;
	}
	
	public boolean equals(Object o){
		if(o.getClass() == Punkt.class){
			return innerequals((Punkt) o);
		}else{
			return false;
		}
	}
	
	private boolean innerequals(Punkt p){
		boolean out = false;
		switch (variante){
		//variante 1
			case 1:
				if(this == p) out = true;
				break;
		//variante 2
			case 2:
				if(x == p.getX() && y == p.getY()){
					out = true;
				}
				break;
		//variante 3
			case 3:
				if(x == p.getX() && y == p.getY()){
					out = true;
				}
				break;
		//default
			default:
				break;
		}
		return out;
	}
	
	public String toString(){
		return " X:"+x+" Y:"+y;
	}

}
